﻿<UserControl 	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 	 
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 	
                xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 	 
                xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                mc:Ignorable="d" 	 
                x:Class="DiskUsage.DriveListBoxControl" 
                x:Name="UserControl" 	
                d:DesignWidth="509"  
                d:DesignHeight="314"
                xmlns:local="clr-namespace:DiskUsage"  >
    
    <UserControl.Resources>
        <Style x:Key="BlueGlowItemContainer" TargetType="{x:Type ListBoxItem}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                        <Border Background="White" CornerRadius="8" BorderThickness="3" x:Name="IconBorder" Margin="8,4,8,4" >
                            <ContentPresenter />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="true">
                                <Setter TargetName="IconBorder" Property="Effect">
                                    <Setter.Value>
                                        <DropShadowEffect ShadowDepth="0" Color="Blue" BlurRadius="10"  />
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot">
        <ListBox ItemsSource="{Binding Mode=OneWay}" 	
                 x:Name="m_listBox"  	 
                 ItemContainerStyle="{StaticResource BlueGlowItemContainer}" BorderThickness="0">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel 
                        Width="{Binding Path=ActualWidth,  RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ScrollContentPresenter}}}" 
                        ItemWidth="260" ItemHeight= "90"
                        MinWidth="{Binding ItemWidth, RelativeSource={RelativeSource Self}}" />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <DockPanel>
                        <Image VerticalAlignment="Top"  Source="{Binding Icon, Mode=OneWay}" Margin="2,10,2,20"/>
                        <TextBlock  DockPanel.Dock="Top" Text="{Binding Name, Mode=OneWay}" FontSize="14" 	 
                                    Foreground="Black"  HorizontalAlignment="Left" Margin="10,0,0,1" />
                        <ProgressBar  DockPanel.Dock="Top" HorizontalAlignment="Left" Height="15" 	 
                                      VerticalAlignment="Top" Width="160"  Value="{Binding PercentageUsed, Mode=OneWay}"   
                                      Foreground="{Binding DiskUsageBarColor, Mode=OneWay}"  	 
                                      Style="{DynamicResource ProgressBarStyleWithoutAnimation}"  Margin="10,5,10,5"	
                                      Visibility="{Binding ShowDiskUsageBar, Mode=OneWay}"/>
                        <TextBlock Text="{Binding FreeSpaceLong, Mode=OneWay}" FontSize="14"  Foreground="Gray" 
                                   HorizontalAlignment="Left" Margin="10,0,0,1" />
                    </DockPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</UserControl>